package com.gf.bigdatatemplate.controller;

import com.gf.bigdatatemplate.entity.Echars;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * @author gFly
 * @date 2024/1/15 13:54
 * @Describe
 */
@Controller
public class IndexController {

    @GetMapping("/")
    public String index(ModelMap map) {
        return "index";
    }

    @PostMapping("num")
    @ResponseBody
    public List<Echars> num() {
        ArrayList<Echars> echars = new ArrayList<>();
        echars.add(new Echars("九号",248));
        echars.add(new Echars("十号",218));
        echars.add(new Echars("十一号",436));
        echars.add(new Echars("十二号",252));
        echars.add(new Echars("十三号",212));
        echars.add(new Echars("十四号",231));
        echars.add(new Echars("十五号",213));

        System.out.println("====");
        return echars;
    }
}
